home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-27 | 1.5 KB | 56 lines | [TEXT/MPS ] |
- //
- // ruleFunction.c
- //
- // This code resource will be called as a Rule Function ( 'inrf' ) from
- // within the "Rule Function [inrf] Example" example.
- //
- // The function below simply calls Gestalt for the system version.
- // If the system version is equal to or greater than 7.5, the function
- // returns true. Otherwise, it returns false. If the call to
- // Gestalt returns an error, an alert is displayed, and we exit
- // to shell, cancelling installation.
- //
- // Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
- //
-
-
- #ifndef __Errors__
- #include <Errors.h>
- #endif
-
- #include <SegLoad.h>
- #include <Gestalt.h>
- #include <Dialogs.h>
- #include <Types.h>
-
- #include "InstallerScript.h"
-
- #define ErrorAlertID 400
-
- //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- // DoRuleFunction
- //
- // NOTE: The name of this function 'DoRuleFunction' should
- // match that specified in the -m option for the line in the
- // makefile that compiles this code resource.
- //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- long DoRuleFunction(RuleFunctionPBPtr ourPBPtr)
- {
- OSErr myErr = noErr;
- long theVersion;
-
- myErr = Gestalt(gestaltSystemVersion, &theVersion);
- if (myErr == noErr)
- {
- if ( (theVersion & 0xFFFF) >= 0x0750 ) // if active system is 7.5.0 or greater
- return (kTRUERuleFunctionResult); // return true
- else
- return (kFALSERuleFunctionResult); // active system isn't 7.5.0 or greater, return false
- }
- else // fatal error
- {
- Alert(ErrorAlertID,0L);
- ExitToShell();
- }
- }